
<div id="form_example">
    <style>
    fieldset table tr em {
        color: #ff0000;
    }

    fieldset table tr th {
        text-align: left;
        vertical-align: top;
    }
    </style>

    <a href="<?php echo $this->url(array('action' => 'index'), 'example_action'); ?>"><?php echo BaseZF::escape(_('Back to example index')); ?></a>
    <form method="post" action="<?php echo $this->url(); ?>">
    <fieldset>
    <legend><?php echo BaseZF::escape(_('Form example by field type')); ?></legend>
        <table>
            <tr>
                <th><label for="text">text</label></th>
                <td><?php echo $this->formText('text', $this->params['text']); ?></td>
                <td><?php echo (isset($this->paramsErrors['text']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['text'])) . '</em>' : '') ?></td>
            </tr>

            <?php /* input type password example */ ?>
            <tr>
                <th><label for="password">password</label></th>
                <td><?php echo $this->formPassword('password', $this->params['password']); ?></td>
                <td><?php echo (isset($this->paramsErrors['password']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['password'])) . '</em>' : '') ?></td>
            </tr>

            <?php /* SelectBox example */ ?>
            <tr>
                <th><label for="select">select</label></th>
                <td>
                <?php
                    $possible_select_values = array(
                        1 => 'Yes',
                        0 => 'No',
                    );

                    echo $this->formSelect('select', $this->params['select'], array(), $possible_select_values);
                ?>
                </td>
                <td><?php echo (isset($this->paramsErrors['select']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['select'])) . '</em>' : '') ?></td>
            </tr>

            <?php /* Textarea example */ ?>
            <tr>
                <th><label for="textarea">textarea</label></th>
                <td><?php echo $this->formTextarea('textarea', $this->params['textarea'], array('cols' => '20', 'rows' => '2')); ?></td>
                <td><?php echo (isset($this->paramsErrors['textarea']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['textarea'])) . '</em>' : '') ?></td>
            </tr>

            <?php /* CheckBox example */ ?>
            <tr>
                <th><label for="checkbox">checkbox</label></th>
                <td></td>
                <td><?php echo (isset($this->paramsErrors['checkbox']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['checkbox'])) . '</em>' : '') ?></td>
            </tr>

            <?php /* Radio example */ ?>
            <tr>
                <th><label for="radio">radio</label></th>
                <td>

                </td>
                <td><?php echo (isset($this->paramsErrors['radio']) ? '<em>' . BaseZF::escape(implode("\n", $this->paramsErrors['radio'])) . '</em>' : '') ?></td>
            </tr>

            <tr>
                <td colspan="3">
                    <?php /* input type hidden example */ ?>
                    <?php echo $this->formHidden('hidden', 1); ?>

                    <?php
                        if (is_null($this->params['no_ajax'])) {
                            echo $this->formHidden('submit', 1);
                            echo $this->formSubmit('ajax', _('Submit with Ajax'));
                        } else {
                            echo $this->formHidden('no_ajax', 1);
                            echo $this->formSubmit('submit', _('Submit'));
                        }
                    ?>

                    <?php echo $this->formReset('cancel', _('Cancel')); ?>
                    <?php
                        if (is_null($this->params['no_ajax'])) {
                            ?>- <a href="<?php echo $this->url(); ?>" name="ajax"><?php echo BaseZF::escape(_('Ajax cancel')); ?></a><?php
                            ?>- <a href="<?php echo $this->url(); ?>?no_ajax=1"><?php echo BaseZF::escape(_('Disable ajax')); ?></a><?php
                        } else {
                            ?>- <a href="<?php echo $this->url(); ?>"><?php echo BaseZF::escape(_('Enable ajax')); ?></a><?php
                        }
                    ?>
                </td>
            </tr>
        </table>
    </fieldset>
    </form>

<fieldset>
    <legend><?php echo BaseZF::escape(_('Form results')); ?></legend>
    <?php
        if (!is_null($this->params['submit'])) {

            echo '<pre>';
            print_r($this->params);
            echo '</pre>';

        } else {
            echo BaseZF::escape(_('Not submited'));
        }
    ?>
</fieldset>

<ul>
    <li><a onclick="window.open(this.href); return false;" href="/doc/html/form_8php-source.html"><?php echo BaseZF::escape(_('See view source')); ?></a></li>
    <li><a onclick="window.open(this.href); return false;" href="/doc/html/classExampleController.html#4a67ba6e1e6bb6f92ca186f42d6eaf60"><?php echo BaseZF::escape(_('See action source')); ?></a></li>
</ul>
</div>

